<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>switch</title>
    <script type="text/javascript">
        var i='Apples';
        switch (i){
            case"Oranges":
                //把内容输出给浏览器
                document.write("Oranges are $4.59 a pound.<BR>");
                break;
            case "Apples":
                document.write("Apples are $2.85 a pound.<BR>");
                break;
            case "Bananas":
                document.write("Bananas are $1.62 a pound.<BR>");
                break;
            case "Cherries":
                document.write("Cherries are $7.65 a pound.<BR>");
                break;
            default:
                document.write("Sorry,we are out of"+i+".<BR>")
        }
    </script>
</head>
<body>

</body>
</html>